using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using Oracle.ManagedDataAccess.Client;
using OracleInternal.Common;

namespace OracleInternal.ConnectionPool
{
	internal class ConnectionString : ICloneable
	{
		private static char s_space;

		private static char s_singleQuote;

		private static char s_doubleQuote;

		private static char s_semiColon;

		private static char s_equalSign;

		private static char[] s_whiteSpace;

		private static char[] s_ignore;

		private static char[] s_quotes;

		private static char[] s_separator;

		private static char[] s_equal;

		private static char[] delim;

		private static char[] delim2;

		public const string s_sysDba = "SYSDBA";

		public const string s_sysOper = "SYSOPER";

		public const string s_sysAsm = "SYSASM";

		public const string s_sysBackup = "SYSBACKUP";

		public const string s_sysDg = "SYSDG";

		public const string s_sysKm = "SYSKM";

		public const string s_sysRac = "SYSRAC";

		private const string s_dataSource = "DATA SOURCE";

		private const string s_dbaPrivilege = "DBA PRIVILEGE";

		private const string s_enlist = "ENLIST";

		private const string s_connectionLifetime = "CONNECTION LIFETIME";

		private const string s_incrPoolSize = "INCR POOL SIZE";

		private const string s_decrPoolSize = "DECR POOL SIZE";

		private const string s_maxPoolSize = "MAX POOL SIZE";

		private const string s_minPoolSize = "MIN POOL SIZE";

		private const string s_password = "PASSWORD";

		private const string s_persistSecurityInfo = "PERSIST SECURITY INFO";

		private const string s_pooling = "POOLING";

		private const string s_connectionTimeout = "CONNECTION TIMEOUT";

		private const string s_connectTimeout = "CONNECT TIMEOUT";

		private const string s_userId = "USER ID";

		private const string s_poolRegulator = "POOL REGULATOR";

		private const string s_tnsAdmin = "TNS_ADMIN";

		private const string s_walletLocation = "WALLET_LOCATION";

		private const string s_promotableTransaction = "PROMOTABLE TRANSACTION";

		private const string s_proxyUserId = "PROXY USER ID";

		private const string s_proxyPassword = "PROXY PASSWORD";

		private const string s_validateConnection = "VALIDATE CONNECTION";

		private const string s_stmtCacheSize = "STATEMENT CACHE SIZE";

		private const string s_stmtCachePurge = "STATEMENT CACHE PURGE";

		private const string s_haEvents = "HA EVENTS";

		private const string s_loadBalancing = "LOAD BALANCING";

		private const string s_metadataPooling = "METADATA POOLING";

		private const string s_contextConnection = "CONTEXT CONNECTION";

		private const string s_selftuning = "SELF TUNING";

		private const string s_applicationContinuity = "APPLICATION CONTINUITY";

		private const string s_connectionPoolTimeout = "CONNECTION POOL TIMEOUT";

		private const string s_lowercase_userid = "user id";

		private const string s_lowercase_password = "password";

		private const string s_lowercase_proxyuserid = "proxy userid";

		private const string s_lowercase_proxypassword = "proxy password";

		private const string s_dynamic = "DYNAMIC";

		public string m_dataSource;

		public OracleDBAPrivilege m_dbaPrivilege;

		public Enlist m_enlist;

		public int m_connectionLifetime;

		public int m_incrPoolSize;

		public int m_decrPoolSize;

		public int m_maxPoolSize;

		public int m_minPoolSize;

		public bool m_persistSecurityInfo;

		public bool m_pooling;

		public int m_connectionTimeout;

		public string m_userId;

		private string m_promotableTransactionString;

		public PromotableTransaction m_promotableTransaction;

		public string m_proxyUserId;

		public bool m_validateConnection;

		public int m_stmtCacheSize;

		public bool m_stmtCachePurge;

		public string m_tnsAdmin;

		public string m_walletLocation;

		public bool m_haEvents;

		public bool m_haEventsPresentInConnString;

		public bool m_loadBalancing;

		public bool m_loadBalancingPresentInConnString;

		public bool m_applicationContinuity;

		public bool m_applicationContinuityPresentInConnString;

		public bool m_metadataPooling;

		public bool m_contextConnection;

		public bool m_selfTuning;

		public ConnectionPoolType m_connectionPoolType;

		public object m_drcpSyncObj = new object();

		public object m_connectionPoolTypeSyncObj = new object();

		public int m_poolRegulator;

		public int m_connectionPoolTimeout;

		internal string m_poolName;

		internal string m_sepsUserId;

		internal string m_sepsProxyUserId;

		public SecureString m_sepsSecuredPassword;

		public SecureString m_sepsSecuredProxyPassword;

		public string m_passwordlessConString;

		public string m_useridKeyValue;

		public bool m_bPasswordSet;

		public bool m_bProxyPasswordSet;

		public bool m_bUserIdSet;

		public bool m_bProxyUserIdSet;

		public bool m_bDBAPrivilegeSet;

		public string m_osUserName;

		public TimeSpan m_connectionLifetimeTimeSpan;

		private static Dictionary<string, bool> m_boolMapping;

		public bool m_bInitilialized;

		public bool m_bSecured;

		public bool m_bPooled;

		public DrcpType m_drcpEnabled;

		public bool m_bModifiedAfterParsing;

		public bool m_bDBStartup;

		public bool m_bPrelimAuthSession;

		public static ConStringPool m_conStringPool;

		public ComparisonType[] m_compTypes;

		public int[] m_compOriStartPos;

		public int[] m_compNewStartPos;

		public int[] m_compLength;

		public string[] m_compSubString;

		public string m_compString;

		public char[] m_compStringChars;

		public ConnectionPoolId m_conPoolKey;

		public OraclePoolManager m_pm;

		public string m_pmId;

		public SecureString m_securedPassword;

		public SecureString m_securedProxyPassword;

		public OracleCredential m_orclCredential;

		public SyncQueueList<SecureString> m_secPwdList;

		public SyncQueueList<SecureString> m_secPxyPwdList;

		internal bool m_bDeadObject;

		public string m_constring;

		internal string m_authString = string.Empty;

		private int m_attrStartPos = -1;

		private int m_attrEndPos = -1;

		private int m_valStartPos = -1;

		private int m_valEndPos = -1;

		private int m_useridPos;

		private int m_useridLength;

		private int m_spaceCount;

		private ComparisonInfo m_compUserId;

		private ComparisonInfo m_compPassword;

		private ComparisonInfo m_compProxyPassword;

		private List<ComparisonInfo> m_compList;

		private int m_currentPos;

		private int m_equalPos = -1;

		private int m_prevSemiPos = -1;

		private int m_pwdlessOffset;

		public int m_key;

		public int m_length;

		public bool m_fetchPdbNameFromDb = true;

		private StringBuilder m_pwdLessCoonStrBuilder;

		internal string ServerID => m_dataSource;

		internal string UserAuthenticationString
		{
			get
			{
				if (m_authString == string.Empty)
				{
					m_authString = "USER ID=" + m_userId;
					if (m_dbaPrivilege != 0)
					{
						m_authString = m_authString + ";DBA PRIVILEGE=" + m_dbaPrivilege;
					}
					if ((m_orclCredential != null && m_orclCredential.m_bProxyUserIdSet) || m_bProxyUserIdSet)
					{
						m_authString = m_authString + ";PROXY USER ID=" + m_proxyUserId;
						if (m_proxyUserId == "/")
						{
							m_authString = m_authString + ";osuser=" + m_osUserName;
						}
					}
					else if (m_userId == "/")
					{
						m_authString = m_authString + ";osuser=" + m_osUserName;
					}
				}
				return m_authString;
			}
		}

		static ConnectionString()
		{
			s_space = ' ';
			s_singleQuote = '\'';
			s_doubleQuote = '"';
			s_semiColon = ';';
			s_equalSign = '=';
			s_whiteSpace = new char[6]
			{
				' ',
				'\n',
				'\r',
				'\t',
				'\v',
				'\f'
			};
			s_ignore = new char[7]
			{
				' ',
				'\n',
				'\r',
				'\t',
				'\v',
				'\f',
				';'
			};
			s_quotes = new char[2]
			{
				s_singleQuote,
				s_doubleQuote
			};
			s_separator = new char[1]
			{
				s_semiColon
			};
			s_equal = new char[1]
			{
				s_equalSign
			};
			delim = new char[3]
			{
				' ',
				'\t',
				'"'
			};
			delim2 = new char[2]
			{
				' ',
				'\''
			};
			m_conStringPool = new ConStringPool(256);
			m_boolMapping = new Dictionary<string, bool>();
			m_boolMapping.Add("TRUE", value: true);
			m_boolMapping.Add("YES", value: true);
			m_boolMapping.Add("FALSE", value: false);
			m_boolMapping.Add("NO", value: false);
		}

		private void Initialize(OracleConnection con, string connectionString)
		{
			m_key = GetKey(con, connectionString, m_orclCredential);
			m_dataSource = string.Empty;
			m_dbaPrivilege = OracleDBAPrivilege.None;
			m_enlist = Enlist.True;
			m_connectionLifetime = 0;
			m_incrPoolSize = 5;
			m_decrPoolSize = 1;
			m_maxPoolSize = 100;
			m_minPoolSize = 1;
			m_persistSecurityInfo = false;
			m_pooling = true;
			m_connectionTimeout = 15;
			m_userId = null;
			m_promotableTransaction = ConfigBaseClass.m_PromotableTransaction;
			m_proxyUserId = null;
			m_validateConnection = false;
			m_stmtCacheSize = ConfigBaseClass.m_StatementCacheSize;
			m_stmtCachePurge = false;
			m_haEvents = true;
			m_loadBalancing = true;
			m_metadataPooling = true;
			m_contextConnection = false;
			m_selfTuning = ConfigBaseClass.m_SelfTuning;
			m_poolRegulator = 180;
			m_connectionPoolTimeout = 15;
			m_passwordlessConString = connectionString;
			m_secPwdList = new SyncQueueList<SecureString>();
			m_secPxyPwdList = new SyncQueueList<SecureString>();
			m_connectionLifetimeTimeSpan = default(TimeSpan);
			m_applicationContinuity = false;
			float result = 0f;
			float.TryParse(ConfigBaseClass.m_cpversion, out result);
			m_connectionPoolType = ConnectionPoolType.CCP;
			m_drcpEnabled = DrcpType.None;
			m_bInitilialized = false;
		}

		public ConnectionString(OracleConnection con, string constring, OracleCredential credential)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2304, OracleTraceClassName.ConnectionString, OracleTraceFuncName.ctor);
			}
			try
			{
				m_orclCredential = credential;
				Initialize(con, constring);
				Parse(con, constring);
				Validate();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268437504, OracleTraceClassName.ConnectionString, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2560, OracleTraceClassName.ConnectionString, OracleTraceFuncName.ctor);
				}
			}
		}

		public void Validate()
		{
			if (m_maxPoolSize < m_minPoolSize)
			{
				throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_INVALID_VALUE, "max pool size", m_maxPoolSize.ToString()));
			}
			if (!m_pooling)
			{
				m_maxPoolSize = int.MaxValue;
				m_minPoolSize = 0;
				m_incrPoolSize = int.MaxValue;
				m_decrPoolSize = 0;
				m_poolRegulator = 0;
			}
		}

		[SecurityPermission(SecurityAction.Assert, Unrestricted = true)]
		public void SetProperty(string key, string value, string quotedValue, string originalKey, SecureString secPasswd)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2304, OracleTraceClassName.ConnectionString, OracleTraceFuncName.SetProperty);
			}
			try
			{
				bool flag = false;
				m_bInitilialized = true;
				if (value == null)
				{
					return;
				}
				if (key != "PASSWORD" && key != "PROXY PASSWORD")
				{
					int num = 0;
					if (m_currentPos + m_pwdlessOffset == m_length)
					{
						num = -1;
					}
					m_pwdLessCoonStrBuilder.Append(m_constring.Substring(m_pwdlessOffset + m_prevSemiPos + 1, m_currentPos - m_prevSemiPos + num));
				}
				switch (key)
				{
				case "DATA SOURCE":
					m_dataSource = value;
					break;
				case "DBA PRIVILEGE":
					switch (value.ToUpperInvariant())
					{
					case "SYSDBA":
						m_dbaPrivilege = OracleDBAPrivilege.SYSDBA;
						break;
					case "SYSOPER":
						m_dbaPrivilege = OracleDBAPrivilege.SYSOPER;
						break;
					case "SYSASM":
						m_dbaPrivilege = OracleDBAPrivilege.SYSASM;
						break;
					case "SYSBACKUP":
						m_dbaPrivilege = OracleDBAPrivilege.SYSBACKUP;
						break;
					case "SYSDG":
						m_dbaPrivilege = OracleDBAPrivilege.SYSDG;
						break;
					case "SYSKM":
						m_dbaPrivilege = OracleDBAPrivilege.SYSKM;
						break;
					case "SYSRAC":
						m_dbaPrivilege = OracleDBAPrivilege.SYSRAC;
						break;
					default:
						flag = true;
						break;
					}
					m_bDBAPrivilegeSet = true;
					break;
				case "ENLIST":
					try
					{
						if (value.ToUpperInvariant() == "DYNAMIC")
						{
							m_enlist = Enlist.Dynamic;
						}
						else if (m_boolMapping[value.ToUpperInvariant()])
						{
							m_enlist = Enlist.True;
						}
						else
						{
							m_enlist = Enlist.False;
						}
					}
					catch
					{
						flag = true;
					}
					break;
				case "CONNECTION LIFETIME":
				{
					int result6 = 0;
					if (int.TryParse(value, out result6) && result6 >= 0)
					{
						m_connectionLifetime = result6;
						m_connectionLifetimeTimeSpan = new TimeSpan(0, 0, result6);
					}
					else
					{
						flag = true;
					}
					break;
				}
				case "INCR POOL SIZE":
				{
					int result2 = 0;
					if (int.TryParse(value, out result2) && result2 > 0)
					{
						m_incrPoolSize = result2;
					}
					else
					{
						flag = true;
					}
					break;
				}
				case "DECR POOL SIZE":
				{
					int result4 = 0;
					if (int.TryParse(value, out result4) && result4 > 0)
					{
						m_decrPoolSize = result4;
					}
					else
					{
						flag = true;
					}
					break;
				}
				case "MAX POOL SIZE":
				{
					int result5 = 0;
					if (int.TryParse(value, out result5) && result5 > 0)
					{
						m_maxPoolSize = result5;
					}
					else
					{
						flag = true;
					}
					break;
				}
				case "MIN POOL SIZE":
				{
					int result7 = 0;
					if (int.TryParse(value, out result7) && result7 >= 0)
					{
						m_minPoolSize = result7;
					}
					else
					{
						flag = true;
					}
					break;
				}
				case "PASSWORD":
					if (secPasswd == null)
					{
						return;
					}
					m_securedPassword = secPasswd;
					m_bPasswordSet = true;
					if (m_valStartPos > 0 && m_valEndPos > 0)
					{
						if (m_compPassword == null)
						{
							m_compPassword = new ComparisonInfo(ComparisonType.Password, m_pwdlessOffset + m_valStartPos, m_valStartPos, m_valEndPos - m_valStartPos + 1, m_pwdlessOffset + m_prevSemiPos + 1, (m_pwdlessOffset + m_currentPos != m_length) ? (m_pwdlessOffset + m_currentPos + 1) : (m_pwdlessOffset + m_currentPos), m_pwdlessOffset + m_currentPos == m_length);
						}
						else
						{
							m_compPassword.m_oriStartPos = m_pwdlessOffset + m_valStartPos;
							m_compPassword.m_newStartPos = m_valStartPos;
							m_compPassword.m_length = m_valEndPos - m_valStartPos + 1;
						}
					}
					if (m_currentPos != m_length)
					{
						if (m_prevSemiPos >= 0)
						{
							m_pwdlessOffset += m_currentPos + 1 - (m_prevSemiPos + 1);
						}
						else
						{
							m_pwdlessOffset += m_currentPos + 1;
						}
					}
					else
					{
						m_pwdlessOffset += m_currentPos - (m_prevSemiPos + 1);
					}
					m_length = m_constring.Length;
					m_currentPos = m_prevSemiPos;
					break;
				case "PERSIST SECURITY INFO":
					try
					{
						m_persistSecurityInfo = m_boolMapping[value.ToUpperInvariant()];
					}
					catch
					{
						flag = true;
					}
					break;
				case "POOLING":
					try
					{
						m_pooling = m_boolMapping[value.ToUpperInvariant()];
					}
					catch
					{
						flag = true;
					}
					break;
				case "CONNECTION TIMEOUT":
				case "CONNECT TIMEOUT":
				{
					int result8 = 0;
					if (int.TryParse(value, out result8) && result8 >= 0)
					{
						m_connectionTimeout = result8;
					}
					else
					{
						flag = true;
					}
					break;
				}
				case "USER ID":
					if (quotedValue == string.Empty)
					{
						return;
					}
					m_userId = quotedValue;
					m_bUserIdSet = true;
					if (m_valStartPos > 0 && m_valEndPos > 0)
					{
						if (m_compUserId == null)
						{
							m_compUserId = new ComparisonInfo(ComparisonType.UserId, m_pwdlessOffset + m_valStartPos, m_valStartPos, m_valEndPos - m_valStartPos + 1, 0, 0, bLastAttribute: false);
						}
						else
						{
							m_compUserId.m_oriStartPos = m_pwdlessOffset + m_valStartPos;
							m_compUserId.m_newStartPos = m_valStartPos;
							m_compUserId.m_length = m_valEndPos - m_valStartPos + 1;
						}
					}
					m_useridPos = m_valStartPos;
					if (m_currentPos != m_length)
					{
						m_useridLength = m_currentPos - m_prevSemiPos;
					}
					else
					{
						m_useridLength = m_currentPos - (m_prevSemiPos + 1);
					}
					if (m_valStartPos > 0)
					{
						if (m_constring[m_pwdlessOffset + m_valStartPos] == '/' && m_valEndPos - m_valStartPos == 0 && m_osUserName == null)
						{
							m_userId = "/";
							m_osUserName = Environment.UserName;
						}
						else if (value.Trim() == "/")
						{
							m_userId = "/";
							m_osUserName = Environment.UserName;
						}
					}
					break;
				case "PROMOTABLE TRANSACTION":
					m_promotableTransactionString = value;
					if (m_promotableTransactionString.ToUpperInvariant() == "PROMOTABLE")
					{
						m_promotableTransaction = PromotableTransaction.Promotable;
					}
					else if (m_promotableTransactionString.ToUpperInvariant() == "LOCAL")
					{
						m_promotableTransaction = PromotableTransaction.Local;
					}
					else
					{
						flag = true;
					}
					break;
				case "PROXY USER ID":
					if (quotedValue == string.Empty)
					{
						return;
					}
					m_proxyUserId = quotedValue;
					m_bProxyUserIdSet = true;
					if (m_valStartPos > 0)
					{
						if (m_constring[m_pwdlessOffset + m_valStartPos] == '/' && m_valEndPos - m_valStartPos == 0 && m_osUserName == null)
						{
							m_proxyUserId = "/";
							m_osUserName = Environment.UserName;
						}
						else if (value == "/")
						{
							m_proxyUserId = "/";
							m_osUserName = Environment.UserName;
						}
					}
					break;
				case "PROXY PASSWORD":
					if (secPasswd == null)
					{
						return;
					}
					m_securedProxyPassword = secPasswd;
					m_bProxyPasswordSet = true;
					if (m_valStartPos > 0 && m_valEndPos > 0)
					{
						if (m_compProxyPassword == null)
						{
							m_compProxyPassword = new ComparisonInfo(ComparisonType.ProxyPassword, m_pwdlessOffset + m_valStartPos, m_valStartPos, m_valEndPos - m_valStartPos + 1, m_pwdlessOffset + m_prevSemiPos + 1, (m_pwdlessOffset + m_currentPos != m_length) ? (m_pwdlessOffset + m_currentPos + 1) : (m_pwdlessOffset + m_currentPos), m_pwdlessOffset + m_currentPos == m_length);
						}
						else
						{
							m_compProxyPassword.m_oriStartPos = m_pwdlessOffset + m_valStartPos;
							m_compProxyPassword.m_newStartPos = m_valStartPos;
							m_compProxyPassword.m_length = m_valEndPos - m_valStartPos + 1;
						}
					}
					if (m_currentPos != m_length)
					{
						if (m_prevSemiPos >= 0)
						{
							m_pwdlessOffset += m_currentPos + 1 - (m_prevSemiPos + 1);
						}
						else
						{
							m_pwdlessOffset += m_currentPos + 1;
						}
					}
					else
					{
						m_pwdlessOffset += m_currentPos - (m_prevSemiPos + 1);
					}
					m_length = m_constring.Length;
					m_currentPos = m_prevSemiPos;
					break;
				case "VALIDATE CONNECTION":
					try
					{
						m_validateConnection = m_boolMapping[value.ToUpperInvariant()];
					}
					catch
					{
						flag = true;
					}
					break;
				case "STATEMENT CACHE SIZE":
				{
					int result3 = 0;
					if (int.TryParse(value, out result3) && result3 >= 0)
					{
						m_stmtCacheSize = result3;
					}
					else
					{
						flag = true;
					}
					break;
				}
				case "STATEMENT CACHE PURGE":
					try
					{
						m_stmtCachePurge = m_boolMapping[value.ToUpperInvariant()];
					}
					catch
					{
						flag = true;
					}
					break;
				case "HA EVENTS":
					try
					{
						m_haEvents = m_boolMapping[value.ToUpperInvariant()];
						m_haEventsPresentInConnString = true;
					}
					catch
					{
						flag = true;
					}
					break;
				case "LOAD BALANCING":
					try
					{
						m_loadBalancing = m_boolMapping[value.ToUpperInvariant()];
						m_loadBalancingPresentInConnString = true;
					}
					catch
					{
						flag = true;
					}
					break;
				case "METADATA POOLING":
					try
					{
						m_metadataPooling = m_boolMapping[value.ToUpperInvariant()];
					}
					catch
					{
						flag = true;
					}
					break;
				case "SELF TUNING":
					try
					{
						m_selfTuning = m_boolMapping[value.ToUpperInvariant()];
					}
					catch
					{
						flag = true;
					}
					break;
				case "APPLICATION CONTINUITY":
					try
					{
						m_applicationContinuity = m_boolMapping[value.ToUpperInvariant()];
						m_applicationContinuityPresentInConnString = true;
					}
					catch
					{
						flag = true;
					}
					break;
				case "POOL REGULATOR":
				{
					int result = 0;
					if (int.TryParse(value, out result) && result >= 0)
					{
						m_poolRegulator = result;
					}
					else
					{
						flag = true;
					}
					break;
				}
				case "TNS_ADMIN":
					m_tnsAdmin = value;
					break;
				case "WALLET_LOCATION":
					m_walletLocation = value;
					break;
				default:
					throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_INVALID_ATTRIB, originalKey));
				}
				if (!flag || !(quotedValue != string.Empty))
				{
					return;
				}
				throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_INVALID_VALUE, originalKey, value));
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268437504, OracleTraceClassName.ConnectionString, OracleTraceFuncName.SetProperty, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2560, OracleTraceClassName.ConnectionString, OracleTraceFuncName.SetProperty);
				}
			}
		}

		public ConnectionString Clone()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2304, OracleTraceClassName.ConnectionString, OracleTraceFuncName.Clone);
			}
			try
			{
				return (ConnectionString)MemberwiseClone();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268437504, OracleTraceClassName.ConnectionString, OracleTraceFuncName.Clone, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2560, OracleTraceClassName.ConnectionString, OracleTraceFuncName.Clone);
				}
			}
		}

		object ICloneable.Clone()
		{
			return Clone();
		}

		private static bool IsOsUserPresentInConString(string constr)
		{
			bool result = false;
			try
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2304, OracleTraceClassName.ConnectionString, OracleTraceFuncName.IsOsUserPresentInConString);
				}
				if (!string.IsNullOrEmpty(constr))
				{
					if (constr.IndexOf("/", StringComparison.InvariantCultureIgnoreCase) != -1)
					{
						int num = constr.IndexOf("user id", StringComparison.InvariantCultureIgnoreCase);
						if (num != -1)
						{
							do
							{
								int num2 = constr.IndexOf(';', num);
								if (num2 == -1)
								{
									num2 = constr.Length - 1;
								}
								string text = constr.Substring(num, num2 - num + 1);
								text = text.TrimEnd(';');
								if (string.IsNullOrEmpty(text))
								{
									continue;
								}
								int num3 = text.IndexOf('=');
								if (num3 == -1)
								{
									if (ProviderConfig.m_bTraceLevelPrivate)
									{
										Trace.Write(OracleTraceLevel.Private, OracleTraceTag.CP, OracleTraceClassName.ConnectionString, OracleTraceFuncName.IsOsUserPresentInConString, "Incorrect format of user id");
									}
									continue;
								}
								int num4 = num3 + 1;
								num4++;
								int length = text.Length;
								string text2 = text.Substring(num3 + 1, length - num4 + 1);
								if (text2.Trim() == "/" || text2.Replace(" ", string.Empty) == "\"/\"")
								{
									result = true;
									if (ProviderConfig.m_bTraceLevelPrivate)
									{
										Trace.Write(OracleTraceLevel.Private, OracleTraceTag.CP, OracleTraceClassName.ConnectionString, OracleTraceFuncName.IsOsUserPresentInConString, "OS user present in connection string");
										return result;
									}
									return result;
								}
							}
							while ((num = constr.IndexOf("user id", num + 1, StringComparison.InvariantCultureIgnoreCase)) != -1);
							return result;
						}
						if (ProviderConfig.m_bTraceLevelPrivate)
						{
							Trace.Write(OracleTraceLevel.Private, OracleTraceTag.CP, OracleTraceClassName.ConnectionString, OracleTraceFuncName.IsOsUserPresentInConString, "no user id or proxy user id present in connection string");
							return result;
						}
						return result;
					}
					if (ProviderConfig.m_bTraceLevelPrivate)
					{
						Trace.Write(OracleTraceLevel.Private, OracleTraceTag.CP, OracleTraceClassName.ConnectionString, OracleTraceFuncName.IsOsUserPresentInConString, "no / present in connection string");
						return result;
					}
					return result;
				}
				return result;
			}
			catch (Exception)
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.CP, OracleTraceClassName.ConnectionString, OracleTraceFuncName.IsOsUserPresentInConString, "Unable to parse the connection string to determine presence of OS user. Returning True.");
				}
				return true;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2560, OracleTraceClassName.ConnectionString, OracleTraceFuncName.IsOsUserPresentInConString);
				}
			}
		}

		[SecurityPermission(SecurityAction.Assert, Unrestricted = true)]
		public static int GetKey(OracleConnection con, string connStr, OracleCredential orclCred)
		{
			int num = 0;
			int num2 = 0;
			bool flag = false;
			if (orclCred != null)
			{
				if (orclCred.m_userId.Trim() == "/" || orclCred.m_userId.Replace(" ", string.Empty) == "\"/\"" || orclCred.m_proxyUserId.Trim() == "/" || orclCred.m_proxyUserId.Replace(" ", string.Empty) == "\"/\"")
				{
					flag = true;
				}
			}
			else
			{
				flag = IsOsUserPresentInConString(connStr);
			}
			string value = string.Empty;
			if (flag)
			{
				value = Environment.UserName;
			}
			StringBuilder stringBuilder = new StringBuilder(256);
			stringBuilder.Append(connStr);
			if (con != null)
			{
				if (!string.IsNullOrEmpty(con.TnsAdminInternal))
				{
					stringBuilder.Append(";tnsadmin=");
					stringBuilder.Append(con.TnsAdminInternal);
				}
				if (!string.IsNullOrEmpty(con.WalletLocationInternal))
				{
					stringBuilder.Append(";wallet=");
					stringBuilder.Append(con.WalletLocationInternal);
				}
				if (!string.IsNullOrEmpty(con.DRCPConnectionClass))
				{
					stringBuilder.Append(";drcpcc=");
					stringBuilder.Append(con.DRCPConnectionClass);
				}
			}
			if (!string.IsNullOrEmpty(value))
			{
				stringBuilder.Append(";osuser=");
				stringBuilder.Append(value);
			}
			num = stringBuilder.ToString().GetHashCode() * 11;
			if (orclCred != null && !orclCred.m_bInternalUse)
			{
				num2 = orclCred.GetHashCode();
				num += num2;
			}
			return num;
		}

		public static ConnectionString GetCS(OracleConnection con, string constr, OracleCredential credential, bool bCreateIfNotinCache)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2304, OracleTraceClassName.ConnectionString, OracleTraceFuncName.GetCS);
			}
			try
			{
				ConnectionString connectionString = null;
				bool flag = false;
				int key = GetKey(con, constr, credential);
				List<ConnectionString> list = m_conStringPool.Get(key);
				if (list != null)
				{
					for (int i = 0; i < list.Count; i++)
					{
						if (flag)
						{
							break;
						}
						connectionString = list[i];
						if (connectionString.Compare(constr))
						{
							flag = true;
							break;
						}
					}
				}
				if (!flag && bCreateIfNotinCache)
				{
					connectionString = new ConnectionString(con, constr, credential);
				}
				return connectionString;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268437504, OracleTraceClassName.ConnectionString, OracleTraceFuncName.GetCS, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2560, OracleTraceClassName.ConnectionString, OracleTraceFuncName.GetCS);
				}
			}
		}

		[SecurityPermission(SecurityAction.Assert, Unrestricted = true)]
		public unsafe bool Compare(string constr)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2304, OracleTraceClassName.ConnectionString, OracleTraceFuncName.Compare);
			}
			try
			{
				int num = 0;
				char[] array = constr.ToCharArray();
				for (int i = 0; i < m_compTypes.Length; i++)
				{
					if (num != 0)
					{
						break;
					}
					if (m_compTypes[i] == ComparisonType.Default)
					{
						for (int j = 0; j < m_compLength[i]; j++)
						{
							if (array[m_compOriStartPos[i] + j] != m_compStringChars[m_compNewStartPos[i] + j])
							{
								num = -1;
								break;
							}
						}
					}
					else if (m_compTypes[i] == ComparisonType.Password)
					{
						if (m_securedPassword.Length != m_compLength[i])
						{
							num = -1;
							break;
						}
						SecureString secPassword = null;
						GetSecurePassword(out secPassword);
						try
						{
							fixed (char* strB = &array[m_compOriStartPos[i]])
							{
								if (!SecureStringsEqual(secPassword, strB, m_compLength[i]))
								{
									num = -1;
								}
							}
						}
						finally
						{
						}
						m_secPwdList.Enqueue(secPassword);
					}
					else
					{
						if (m_compTypes[i] != ComparisonType.ProxyPassword)
						{
							continue;
						}
						if (m_securedProxyPassword.Length != m_compLength[i])
						{
							num = -1;
							break;
						}
						SecureString secProxyPassword = null;
						GetSecureProxyPassword(out secProxyPassword);
						try
						{
							fixed (char* strB2 = &array[m_compOriStartPos[i]])
							{
								if (!SecureStringsEqual(secProxyPassword, strB2, m_compLength[i]))
								{
									num = -1;
								}
							}
						}
						finally
						{
						}
						m_secPwdList.Enqueue(secProxyPassword);
					}
				}
				if (num == 0 && m_osUserName != null)
				{
					num = ((!(m_osUserName == Environment.UserName)) ? 1 : 0);
				}
				if (num == 0)
				{
					return true;
				}
				return false;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268437504, OracleTraceClassName.ConnectionString, OracleTraceFuncName.Compare, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2560, OracleTraceClassName.ConnectionString, OracleTraceFuncName.Compare);
				}
			}
		}

		public string Parse(OracleConnection con, string constr)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2304, OracleTraceClassName.ConnectionString, OracleTraceFuncName.Parse);
			}
			try
			{
				char c = '\0';
				bool flag = false;
				bool flag2 = false;
				bool flag3 = false;
				bool flag4 = true;
				bool flag5 = false;
				bool flag6 = false;
				bool flag7 = false;
				m_constring = constr;
				m_length = constr.Length;
				m_pwdLessCoonStrBuilder = new StringBuilder(m_length);
				m_currentPos = 0;
				while (m_pwdlessOffset + m_currentPos <= m_length)
				{
					char c2 = ((m_pwdlessOffset + m_currentPos >= m_length) ? ';' : m_constring[m_pwdlessOffset + m_currentPos]);
					if (!flag5 || c2 == c)
					{
						if (c2 == s_equalSign && !flag5 && !flag)
						{
							flag = true;
							flag3 = true;
							flag6 = false;
							m_equalPos = m_currentPos;
							flag7 = ((constr.Substring(m_attrStartPos + m_pwdlessOffset, m_attrEndPos - m_attrStartPos + 1).Trim().ToUpperInvariant() == "DATA SOURCE") ? true : false);
						}
						else if (c2 == s_singleQuote)
						{
							if (flag3)
							{
								if (!flag6)
								{
									c = s_singleQuote;
									flag6 = true;
									flag5 = true;
								}
								m_valStartPos = m_currentPos;
							}
							else if (flag6 && c == s_singleQuote)
							{
								flag5 = false;
								m_valEndPos = m_currentPos;
							}
							else if (!flag5 && flag7)
							{
								m_valEndPos = m_currentPos;
							}
							else if (!flag7)
							{
								throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_NOT_WELL_FORMED));
							}
							flag3 = false;
						}
						else if (c2 == s_doubleQuote)
						{
							if (flag3)
							{
								if (!flag6)
								{
									c = s_doubleQuote;
									flag6 = true;
									flag5 = true;
								}
								m_valStartPos = m_currentPos;
							}
							else if (flag6 && c == s_doubleQuote)
							{
								flag5 = false;
								m_valEndPos = m_currentPos;
							}
							else if (!flag5 && flag7)
							{
								m_valEndPos = m_currentPos;
							}
							else if (!flag7)
							{
								throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_NOT_WELL_FORMED));
							}
							flag3 = false;
						}
						else if (c2 == s_semiColon)
						{
							if (!flag5 && flag2 && flag)
							{
								if (m_attrStartPos >= 0 && m_attrEndPos >= 0)
								{
									string text = constr.Substring(m_attrStartPos + m_pwdlessOffset, m_attrEndPos - m_attrStartPos + 1);
									string text2 = string.Empty;
									string text3 = string.Empty;
									SecureString secureString = null;
									string text4 = text.ToUpperInvariant();
									if (m_valStartPos >= 0 && m_valEndPos >= 0)
									{
										if (c != 0)
										{
											m_valStartPos++;
											m_valEndPos--;
										}
										if (text4 == "PASSWORD" || text4 == "PROXY PASSWORD")
										{
											secureString = new SecureString();
											if (c != 0 && c != s_doubleQuote)
											{
												secureString.AppendChar(c);
												char c3 = '\0';
												for (int i = m_pwdlessOffset + m_valStartPos; i <= m_pwdlessOffset + m_valEndPos; i++)
												{
													if (c3 != c || m_constring[i] != c)
													{
														secureString.AppendChar(m_constring[i]);
														c3 = m_constring[i];
													}
													else
													{
														c3 = '\0';
													}
												}
												secureString.AppendChar(c);
											}
											else
											{
												for (int j = m_pwdlessOffset + m_valStartPos; j <= m_pwdlessOffset + m_valEndPos; j++)
												{
													secureString.AppendChar(m_constring[j]);
												}
											}
											secureString.MakeReadOnly();
										}
										else
										{
											text2 = m_constring.Substring(m_pwdlessOffset + m_valStartPos, m_valEndPos - m_valStartPos + 1);
											text3 = ((c == '\'' && text4.Equals("USER ID")) ? text2 : ((c == '\0') ? text2 : (c + text2.Replace(c.ToString() + c, c.ToString()) + c)));
										}
										if (c != 0)
										{
											m_valStartPos--;
											m_valEndPos++;
										}
									}
									if (string.Compare(text, "USER ID", ignoreCase: true, CultureInfo.InvariantCulture) == 0 || string.Compare(text, "PROXY USER ID", ignoreCase: true, CultureInfo.InvariantCulture) == 0 || string.Compare(text, "PASSWORD", ignoreCase: true) == 0 || string.Compare(text, "PROXY PASSWORD", ignoreCase: true) == 0)
									{
										text3 = text3.Trim(' ', '\t');
									}
									SetProperty(text4, text2, text3, text, secureString);
								}
								m_spaceCount = 0;
							}
							else
							{
								if ((flag2 || flag) && (m_attrStartPos == -1 || m_valStartPos == -1))
								{
									throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_NOT_WELL_FORMED));
								}
								if (m_currentPos + m_pwdlessOffset != m_length)
								{
									m_pwdLessCoonStrBuilder.Append(";");
								}
							}
							m_prevSemiPos = m_currentPos;
							flag4 = true;
							flag = false;
							flag2 = false;
							flag3 = false;
							flag5 = false;
							flag6 = false;
							c = '\0';
							m_equalPos = -1;
							m_attrStartPos = -1;
							m_attrEndPos = -1;
							m_valStartPos = -1;
							m_valEndPos = -1;
							if (m_currentPos + m_pwdlessOffset != m_length)
							{
								m_spaceCount = 0;
							}
							flag3 = false;
						}
						else if (m_constring[m_currentPos + m_pwdlessOffset] == s_space)
						{
							m_spaceCount++;
						}
						else
						{
							flag2 = true;
							if (!flag7 && m_equalPos > 0 && flag6 && !flag5)
							{
								throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_NOT_WELL_FORMED));
							}
							if (flag4)
							{
								m_attrStartPos = m_currentPos;
								flag4 = false;
							}
							else if (m_equalPos == -1)
							{
								m_attrEndPos = m_currentPos;
							}
							if (flag3)
							{
								m_valStartPos = m_currentPos;
								m_valEndPos = m_currentPos;
								flag3 = false;
							}
							else if (m_equalPos > 0)
							{
								m_valEndPos = m_currentPos;
							}
						}
					}
					m_currentPos++;
				}
				if (flag5)
				{
					throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_STR_NOT_WELL_FORMED));
				}
				if (m_spaceCount > 0)
				{
					m_pwdLessCoonStrBuilder.Append(new string(' ', m_spaceCount));
				}
				m_compList = new List<ComparisonInfo>();
				if (!m_bProxyUserIdSet)
				{
					m_compUserId = null;
				}
				else if (m_compUserId != null)
				{
					m_compList.Add(m_compUserId);
				}
				if (m_compPassword != null)
				{
					m_compList.Add(m_compPassword);
				}
				if (m_compProxyPassword != null)
				{
					m_compList.Add(m_compProxyPassword);
				}
				if (m_compList.Count > 1)
				{
					m_compList.Sort(m_compList[0]);
				}
				int num = 0;
				int newStartPos = 0;
				for (int k = 0; k < m_compList.Count; k++)
				{
					if (m_compList[k].m_compType != ComparisonType.UserId && num < m_compList[k].m_oriStartPos)
					{
						m_compList.Insert(k, new ComparisonInfo(ComparisonType.Default, num, newStartPos, m_compList[k].m_oriStartPos - num, 0, 0, bLastAttribute: false));
						k++;
						num = m_compList[k].m_oriStartPos + m_compList[k].m_length;
						newStartPos = m_compList[k].m_newStartPos;
					}
				}
				if (m_compList.Count > 0 && m_compList[m_compList.Count - 1].m_oriStartPos + m_compList[m_compList.Count - 1].m_length < constr.Length)
				{
					m_compList.Add(new ComparisonInfo(ComparisonType.Default, num, newStartPos, constr.Length - num, 0, 0, bLastAttribute: false));
				}
				if (m_compList.Count == 0)
				{
					m_compList.Add(new ComparisonInfo(ComparisonType.Default, 0, 0, constr.Length, 0, 0, bLastAttribute: false));
				}
				int count = m_compList.Count;
				m_compTypes = new ComparisonType[count];
				m_compOriStartPos = new int[count];
				m_compNewStartPos = new int[count];
				m_compLength = new int[count];
				m_compSubString = new string[count];
				m_compString = constr;
				for (int l = 0; l < m_compList.Count; l++)
				{
					m_compTypes[l] = m_compList[l].m_compType;
					m_compOriStartPos[l] = m_compList[l].m_oriStartPos;
					m_compNewStartPos[l] = m_compList[l].m_newStartPos;
					m_compLength[l] = m_compList[l].m_length;
					m_compSubString[l] = m_compString.Substring(m_compNewStartPos[l], m_compLength[l]);
				}
				for (int num2 = m_compList.Count - 1; num2 >= 0; num2--)
				{
					if (m_compTypes[num2] == ComparisonType.UserId)
					{
						if (m_pmId == null)
						{
							m_pmId = m_compString.Substring(0, m_compOriStartPos[num2]) + m_compString.Substring(m_compOriStartPos[num2] + m_compLength[num2]);
						}
					}
					else if (m_compTypes[num2] != 0)
					{
						m_compString = m_compString.Substring(0, m_compOriStartPos[num2]) + m_compString.Substring(m_compOriStartPos[num2] + m_compLength[num2]);
					}
				}
				m_compStringChars = m_compString.ToCharArray();
				if (m_pmId == null)
				{
					m_pmId = m_compString;
				}
				if (con != null)
				{
					if (!string.IsNullOrEmpty(con.TnsAdminInternal))
					{
						m_pmId = m_pmId + ";tnsadmin=" + con.TnsAdminInternal;
					}
					if (!string.IsNullOrEmpty(con.WalletLocationInternal))
					{
						m_pmId = m_pmId + ";walletlocation=" + con.WalletLocationInternal;
					}
					if (!string.IsNullOrEmpty(con.DRCPConnectionClass))
					{
						m_pmId = m_pmId + ";drcpcc=" + con.DRCPConnectionClass;
					}
				}
				m_passwordlessConString = m_pwdLessCoonStrBuilder.ToString();
				m_poolName = GetPoolNameFromConfig(m_passwordlessConString);
				CalculatePwdLessOffset();
				return m_pmId;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268437504, OracleTraceClassName.ConnectionString, OracleTraceFuncName.Parse, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2560, OracleTraceClassName.ConnectionString, OracleTraceFuncName.Parse);
				}
			}
		}

		private void CalculatePwdLessOffset()
		{
			if (m_compPassword != null)
			{
				if (!m_compPassword.m_bLastAttribute)
				{
					if (m_compPassword.m_attrStartPos >= 1)
					{
						m_pwdlessOffset += m_compPassword.m_attrEndPos - m_compPassword.m_attrStartPos;
					}
					else
					{
						m_pwdlessOffset += m_compPassword.m_attrEndPos;
					}
				}
				else
				{
					m_pwdlessOffset += m_compPassword.m_attrEndPos - 1 - m_compPassword.m_attrStartPos;
				}
			}
			if (m_compProxyPassword == null)
			{
				return;
			}
			if (!m_compProxyPassword.m_bLastAttribute)
			{
				if (m_compProxyPassword.m_attrStartPos >= 1)
				{
					m_pwdlessOffset += m_compProxyPassword.m_attrEndPos - m_compProxyPassword.m_attrStartPos;
				}
				else
				{
					m_pwdlessOffset += m_compProxyPassword.m_attrEndPos;
				}
			}
			else
			{
				m_pwdlessOffset += m_compProxyPassword.m_attrEndPos - 1 - m_compProxyPassword.m_attrStartPos;
			}
		}

		private string GetPoolNameFromConfig(string passwordlessConString)
		{
			if (ConfigBaseClass.m_connectionPoolNameMapping.ContainsKey(passwordlessConString))
			{
				return ConfigBaseClass.m_connectionPoolNameMapping[passwordlessConString] as string;
			}
			return passwordlessConString;
		}

		public static string GetStringFromSecureString(SecureString ss)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2304, OracleTraceClassName.ConnectionString, OracleTraceFuncName.GetStringFromSecureString);
			}
			try
			{
				IntPtr zero = IntPtr.Zero;
				zero = Marshal.SecureStringToGlobalAllocUnicode(ss);
				try
				{
					if (zero != IntPtr.Zero)
					{
						return Marshal.PtrToStringUni(zero);
					}
					return string.Empty;
				}
				finally
				{
					if (zero != IntPtr.Zero)
					{
						Marshal.ZeroFreeGlobalAllocUnicode(zero);
					}
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268437504, OracleTraceClassName.ConnectionString, OracleTraceFuncName.GetStringFromSecureString, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2560, OracleTraceClassName.ConnectionString, OracleTraceFuncName.GetStringFromSecureString);
				}
			}
		}

		internal bool GetSecurePassword(out SecureString secPassword)
		{
			bool num = m_secPwdList.Dequeue(out secPassword);
			if (!num && m_securedPassword != null)
			{
				secPassword = m_securedPassword.Copy();
			}
			return num;
		}

		internal bool GetSecureProxyPassword(out SecureString secProxyPassword)
		{
			secProxyPassword = null;
			bool num = m_secPwdList.Dequeue(out secProxyPassword);
			if (!num && m_securedProxyPassword != null)
			{
				secProxyPassword = m_securedProxyPassword.Copy();
			}
			return num;
		}

		internal string ConstructConString(OracleConnection con)
		{
			StringBuilder stringBuilder = new StringBuilder(1024);
			stringBuilder.Append("datasrc=");
			stringBuilder.Append(m_dataSource);
			stringBuilder.Append(";enlist=");
			stringBuilder.Append(m_enlist);
			stringBuilder.Append(";lifetime=");
			stringBuilder.Append(m_connectionLifetime);
			stringBuilder.Append(";maxsize=");
			stringBuilder.Append(m_maxPoolSize);
			stringBuilder.Append(";minsize=");
			stringBuilder.Append(m_minPoolSize);
			stringBuilder.Append(";incsize=");
			stringBuilder.Append(m_incrPoolSize);
			stringBuilder.Append(";decsize=");
			stringBuilder.Append(m_decrPoolSize);
			stringBuilder.Append(";timeout=");
			stringBuilder.Append(m_connectionTimeout);
			stringBuilder.Append(";dbapriv=");
			stringBuilder.Append(m_dbaPrivilege);
			stringBuilder.Append(";validcon=");
			stringBuilder.Append(m_validateConnection);
			stringBuilder.Append(";pooling=");
			stringBuilder.Append(m_pooling);
			stringBuilder.Append(";stmtcache=");
			stringBuilder.Append(m_stmtCacheSize);
			if (m_stmtCacheSize > 0)
			{
				stringBuilder.Append(";stmtcachepurge=");
				stringBuilder.Append(m_stmtCachePurge);
			}
			else
			{
				stringBuilder.Append(";stmtcachepurge=0");
			}
			stringBuilder.Append(";metapool=");
			stringBuilder.Append(m_metadataPooling);
			stringBuilder.Append(";pspe=");
			stringBuilder.Append(m_promotableTransaction);
			stringBuilder.Append(";ha=");
			stringBuilder.Append(m_haEvents ? 1 : 0);
			stringBuilder.Append(";rlb=");
			stringBuilder.Append(m_loadBalancing ? 1 : 0);
			stringBuilder.Append(";ac=");
			stringBuilder.Append(m_applicationContinuity ? 1 : 0);
			if (m_proxyUserId != null && m_proxyUserId.Length > 0)
			{
				stringBuilder.Append(";pxyusr=");
				stringBuilder.Append(m_proxyUserId);
			}
			else
			{
				bool flag = false;
				if (m_userId != null && m_userId.Trim(delim) == "/")
				{
					flag = true;
				}
				if (flag)
				{
					stringBuilder.Append(";osuserid=");
					stringBuilder.Append(Environment.UserName);
				}
				else
				{
					stringBuilder.Append(";userid=");
					stringBuilder.Append(m_userId);
				}
			}
			if (con != null)
			{
				if (!string.IsNullOrEmpty(con.TnsAdminInternal))
				{
					stringBuilder.Append(";tnsadmin=");
					stringBuilder.Append(con.TnsAdminInternal);
				}
				if (!string.IsNullOrEmpty(con.WalletLocationInternal))
				{
					stringBuilder.Append(";walletlocation=");
					stringBuilder.Append(con.WalletLocationInternal);
				}
				if (!string.IsNullOrEmpty(con.DRCPConnectionClass))
				{
					stringBuilder.Append(";drcpcc=");
					stringBuilder.Append(con.DRCPConnectionClass);
				}
			}
			return stringBuilder.ToString();
		}

		public unsafe static bool SecureStringsEqual(SecureString strA, SecureString strB)
		{
			if ((strA == null && strB != null) || (strA != null && strB == null))
			{
				return false;
			}
			if (strA == null && strB == null)
			{
				return true;
			}
			if (strA.Length != strB.Length)
			{
				return false;
			}
			IntPtr intPtr = IntPtr.Zero;
			IntPtr intPtr2 = IntPtr.Zero;
			RuntimeHelpers.PrepareConstrainedRegions();
			try
			{
				intPtr = Marshal.SecureStringToGlobalAllocUnicode(strA);
				intPtr2 = Marshal.SecureStringToGlobalAllocUnicode(strB);
				char* ptr = (char*)intPtr.ToPointer();
				char* ptr2 = (char*)intPtr2.ToPointer();
				while (*ptr != 0 && *ptr2 != 0)
				{
					if (*ptr != *ptr2)
					{
						return false;
					}
					ptr++;
					ptr2++;
				}
				return true;
			}
			finally
			{
				if (intPtr != IntPtr.Zero)
				{
					Marshal.ZeroFreeGlobalAllocUnicode(intPtr);
				}
				if (intPtr2 != IntPtr.Zero)
				{
					Marshal.ZeroFreeGlobalAllocUnicode(intPtr2);
				}
			}
		}

		public unsafe static bool SecureStringsEqual(SecureString strA, char* strB)
		{
			if ((strA == null && null != strB) || (strA != null && null == strB))
			{
				return false;
			}
			if (strA == null && null == strB)
			{
				return true;
			}
			IntPtr intPtr = IntPtr.Zero;
			RuntimeHelpers.PrepareConstrainedRegions();
			char* ptr = null;
			try
			{
				intPtr = Marshal.SecureStringToGlobalAllocUnicode(strA);
				ptr = strB;
				char* ptr2 = (char*)intPtr.ToPointer();
				char* ptr3 = ptr;
				while (*ptr2 != 0 && *ptr3 != 0)
				{
					if (*ptr2 != *ptr3)
					{
						return false;
					}
					ptr2++;
					ptr3++;
				}
				return true;
			}
			finally
			{
				if (intPtr != IntPtr.Zero)
				{
					Marshal.ZeroFreeGlobalAllocUnicode(intPtr);
				}
				if (ptr != null)
				{
					ptr = null;
				}
			}
		}

		public unsafe static bool SecureStringsEqual(SecureString strA, char* strB, int bLength)
		{
			if ((strA == null && null != strB) || (strA != null && null == strB))
			{
				return false;
			}
			if (strA == null && null == strB)
			{
				return true;
			}
			if (strA.Length != bLength)
			{
				return false;
			}
			IntPtr intPtr = IntPtr.Zero;
			RuntimeHelpers.PrepareConstrainedRegions();
			char* ptr = null;
			try
			{
				intPtr = Marshal.SecureStringToGlobalAllocUnicode(strA);
				ptr = strB;
				char* ptr2 = (char*)intPtr.ToPointer();
				char* ptr3 = ptr;
				while (*ptr2 != 0 && *ptr3 != 0)
				{
					if (*ptr2 != *ptr3)
					{
						return false;
					}
					ptr2++;
					ptr3++;
				}
				return true;
			}
			finally
			{
				if (intPtr != IntPtr.Zero)
				{
					Marshal.ZeroFreeGlobalAllocUnicode(intPtr);
				}
				if (ptr != null)
				{
					ptr = null;
				}
			}
		}
	}
}
